﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace Kinect_Interface_Prototype_1.Folder_Control
{
    public abstract class Item
    {
        public string Name { get; set; }
        public string Path { get; set; }
        public ItemType Type { get; set; }
        public Icon Icon { get; set; }

        public abstract List<Item> onClick();

        protected string GetName(string path)
        {
            int index = path.LastIndexOf(@"\") + 1;

            if (index == path.Length)
            {
                path = path.Remove(index - 1);
                index = path.LastIndexOf(@"\") + 1;
            }

            return path.Substring(index, path.Length - index);
        }
    }

    public class ErrorItem : Item
    {
        private string ErrorMessage;

        public ErrorItem(string name, string path, Icon icon, string errorMessage)
        {
            Name = name;
            Path = path;
            Type = ItemType.None;
            Icon = icon;
            ErrorMessage = errorMessage;
        }
        
        public override List<Item> onClick()
        {
            MessageBox.Show(ErrorMessage);
            return null;
        }
    }

    public enum ItemType
    {
        File,
        Folder,
        Link,
        SpecialFolder,
        None
    }
}
